<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=<device-width>, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <form action="http://path/to/resource" method="post">
        <input type="text" name="username">
        <input type="password" name="password">
        <input type="submit" value="提交">
    </form>
    <!-- 引入jquery -->
    <script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
    <script>
         $.ajax({
                url: "https://path/to/resource",
                type: "post",
                contentType: "application/json",
                data: '{"id":1,"username":"zhangsan"}', 
                success: function(result) {
                    console.log("响应");
                }
            });
    </script>

</body>
</html>